<template>
  <div class="stepBarHome">
    <div class="stepBarHome_left">
      <img class="stepBarHome_left_img" :src="isImg()" alt="">
      <div v-if="index + 1 < langth" class="stepBarHome_left_wire"></div>
    </div>
    <div class="stepBarHome_right">
      <div class="stepBarHome_right_title">
        <div :class="{ title_left: true, reject: row.auditStatus == 1, sponsor: row.auditStatus == 0, pass: row.auditStatus == 2 }">
          {{ satusName() }}
        </div>
        <div class="title_right">{{ satusTime() }}</div>
      </div>
      <div v-if="satusName() === '已驳回'" class="stepBarHome_right_content">
        <div class="danger">{{ row?.auditRefuseRemark }}</div>
      </div>
      <div v-else-if="satusName() === '发起审批'" class="stepBarHome_right_content">
        <div class="number">邀约数量：{{ Number(row?.requestSampleNum) }}件</div>
      </div>
      <div v-else-if="satusName() === '已通过'" class="stepBarHome_right_content">
        <div class="number">补样数量：{{ Number(row?.passNum) }}件</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
import icon_yibohui from '@/assets/porduct/icon_yibohui.png'
import icon_faqishenpi from '@/assets/porduct/icon_faqishenpi.png'
import icon_yitongguo from '@/assets/porduct/icon_yitongguo.png'
const props = defineProps(['row', 'index', 'langth', 'auditStatus', 'status', 'hmMechanismsList'])

// 步骤条中状态小图标的显示
const isImg = () => {
  if (props.row.auditStatus === 0) {
    return icon_faqishenpi
  }
  if (props.row.auditStatus === 1) {
    return icon_yibohui
  }
  if (props.row.auditStatus === 2) {
    return icon_yitongguo
  }
}

// 步骤条中审批状态的显示
const satusName = () => {
  if (props.row?.auditStatus === 0) {
    return '发起审批'
  }
  if (props.row?.auditStatus === 2) {
    return '已通过'
  }
  if (props.row?.auditStatus === 1) {
    return '已驳回'
  }
}



// 步骤条中审批时间的显示
const satusTime = () => {
  if (props.row?.auditStatus === 0) {
    return `${props.row?.requestDeptName || ''} ${props.row?.requestTime}`
  }
  if (props.row?.auditStatus === 1) {
    return `${props.row?.auditUserName || ''} ${props.row?.auditRefuseTime}`
  }
  if (props.row?.auditStatus === 2) {
    return `${props.row?.auditUserName || ''} ${props.row?.auditPassTime}`
  }
}

</script>

<style lang="less" scoped>
.stepBarHome {
  width: 100%;
  display: flex;

  .stepBarHome_left {
    margin-right: 10px;
    display: flex;
    flex-flow: column;
    align-items: center;

    .stepBarHome_left_img {
      width: 18px;
      height: 18px;
      transform: translateY(-2px);
      margin-bottom: 3px;
    }

    .stepBarHome_left_wire {
      flex: 1;
      width: 1px;
      background: #E6E6E6;
      background: #0094FF;
      margin-bottom: 5px;
    }
  }

  .stepBarHome_right {
    flex: 1;
    min-width: 0;

    .stepBarHome_right_title {
      width: 100%;
      height: 15px;
      margin-bottom: 5px;
      display: flex;
      align-items: center;
      justify-content: space-between;

      .title_left {
        font-weight: 500;
        font-size: 16px;
      }

      .reject {
        color: #FC2540;
      }

      .sponsor {
        color: #0094FF;
      }

      .pass {
        color: #19D11B;
      }

      .title_right {
        font-weight: 400;
        font-size: 12px;
        color: #8492AD;
      }
    }

    .stepBarHome_right_content {
      min-height: 35px;
      text-align: right;
      padding: 5px 0 10px;
      font-weight: 400;
      font-size: 14px;
      color: #1A1B1C;
      box-sizing: border-box;
      word-wrap: break-word;

      .number {
        width: 100%;
        height: 44px;
        background: linear-gradient(#FBFCFE 0%, #EFF6FF 100%);
        border-radius: 10px;
        font-weight: 500;
        font-size: 14px;
        color: #0094FF;
        display: flex;
        align-items: center;
        padding-left: 10px;
        box-sizing: border-box;
      }

      .danger {
        width: 100%;
        height: 44px;
        background: linear-gradient(#FEFBFB 0%, #FFEFEF 100%);
        border-radius: 10px;
        font-weight: 500;
        font-size: 14px;
        color: #FC2540;
        display: flex;
        align-items: center;
        padding-left: 10px;
        box-sizing: border-box;
      }
    }
  }
}

.content_sponsor_item {
  white-space: nowrap;
  text-align: left;

  .item_one {
    display: inline-block;
    width: 56px;
    height: 24px;
    background: linear-gradient(146deg, #0064FF 0%, #008FFF 100%);
    border-radius: 2px;
    line-height: 24px;
    text-align: center;
    font-weight: 400;
    font-size: 14px;
    color: #FFFFFF;
    vertical-align: middle;
    margin-right: 10px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  .jz_1 {
    width: 45px;
    height: 13px;
    background: url("@/assets/newui/details/icon_jizhiyibai@2x.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }

  .jz_2 {
    width: 45px;
    height: 13px;
    background: url("@/assets/newui/details/icon_jizhierbai@2x.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }

  .jz_3 {
    width: 45px;
    height: 13px;
    background: url("@/assets/newui/details/icon_jizhisanbai@2x.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }

  .item_one_hone {
    background: red;
  }

  .item_two {
    display: inline-block;
    min-width: 130px;
    vertical-align: middle;
    margin-right: 10px;

    .item_two_left {
      display: inline-block;
      font-weight: 400;
      font-size: 16px;
      color: #FC2540;
      vertical-align: middle;
      margin-right: 10px;
    }



    .item_two_title {
      display: inline-block;
      font-weight: 400;
      font-size: 14px;
      color: #0094FF;
      vertical-align: middle;
    }

    .item_two_lan {
      display: inline-block;
      margin-left: 10px;
      font-weight: 400;
      font-size: 16px;
      color: #0094FF;
      vertical-align: middle;
    }
  }


}

.item_two_right {
  display: flex;
  background: linear-gradient(136deg, #E9D1A5 0%, #CEA46C 100%);
  border-radius: 2px;
  height: 18px;
  margin-top: 10px;
  width: fit-content;
  vertical-align: middle;

  .item_two_right_left {
    width: 22px;
    background: #1B1714;
    border-radius: 2px;
    font-weight: 400;
    font-size: 12px;
    color: #CEA46C;
    line-height: 18px;
    text-align: center;
    vertical-align: middle;
  }

  .item_two_right_right {
    line-height: 18px;
    text-align: center;
    font-weight: 500;
    font-size: 12px;
    color: #1B1714;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    padding: 0 5px;
  }
}

.item_three {
  width: 100%;
  word-wrap: break-word;
  word-break: break-all;
  white-space: normal;
  text-align: left;
  padding: 7px 0;
  font-weight: 500;
  font-size: 14px;
  color: #0094FF;
  line-height: 20px;
}

.mb15 {
  margin-bottom: 15px;
}
</style>